package com.sure0000.io;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;

public class SocketClient {
   public static void main(String[] args) {
      String host = "172.20.71.30";
      int port = 55533;
      try (
            Socket socket = new Socket(host, port);
            OutputStream outputStream = socket.getOutputStream();) {
         String message = "你好  xu";
         socket.getOutputStream().write(message.getBytes("UTF-8"));
         InputStream is = socket.getInputStream();
         // BufferedReader br = new BufferedReader(new InputStreamReader(is));
         // StringBuffer result = new StringBuffer();
         // String info = null;
         // while ((info = br.readLine()) != null) {
         //    result.append(info);
         // }
         // System.out.println(result.toString());
      } catch (Exception e) {
         e.printStackTrace();
      }
   }
}
